﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace rock.UI
{
    public partial class UserControlCommonListHeader : UserControl
    {

        bool _AddAble = true;
        public bool AddAble
        {
            get{ return _AddAble;  }
            set {   _AddAble = value; }
        }

        bool _UpdateAble = true;
        public bool UpdateAble
        {
            get { return _UpdateAble; }
            set { _UpdateAble = value; }
        }

        bool _DeleteAble = true;
        public bool DeleteAble
        {
            get { return _DeleteAble; }
            set { _DeleteAble = value; }
        }

        bool _ImportAble = false;
        public bool ImportAble
        {
            get { return _ImportAble; }
            set { _ImportAble = value; }
        }

       

        bool _SelectAble = false;
        public bool SelectAble
        {
            get { return _SelectAble; }
            set { _SelectAble = value; }
        }


        public UserControlCommonListHeader()
        {
            InitializeComponent();
        }

        private void UserControlCommonListHeader_Load(object sender, EventArgs e)
        {
            this.button1Import.Visible = _ImportAble;
 
             this.button3Select.Visible = _SelectAble;
             this.button1Add.Visible = _AddAble;
             this.button2Update.Visible = _UpdateAble;
             this.button3Detele.Visible = _DeleteAble;
        }

        private void button1Add_Click(object sender, EventArgs e)
        {
            addClick();
        }

        private void button2Update_Click(object sender, EventArgs e)
        {
            updateClick();
        }

        private void button3Detele_Click(object sender, EventArgs e)
        {
            deleteClick();
        }
        //导入
        private void button1_Click(object sender, EventArgs e)
        {
            importClick();
        }
 
        //查询
        private void button3_Click(object sender, EventArgs e)
        {
            if (this.textBox1.Text != null) {
                this.textBox1.Text = this.textBox1.Text.Trim();
            }
            
            searchClick();
        }

        //代理
        public delegate void AddClick();
        public AddClick addClick;


        //代理
        public delegate void UpdateClick();
        public UpdateClick updateClick;

        //代理
        public delegate void DeleteClick();
        public DeleteClick deleteClick;

        //代理
        public delegate void ImportClick();
        public ImportClick importClick;

    

        //代理
       // public delegate void SelectClick();
       // public SelectClick selectClick;



        //代理
        public delegate void SearchClick();
        public SearchClick searchClick;

        private void textBox1_TextChanged(object sender, EventArgs e)
        {

        }
    }
}
